package org.meb.conquest.rest.service;

public class Constant {
	
	public static final String HOST = getSystemProperty("conquest.host", "www.conquestdb.com");
	public static final String PORT = getSystemProperty("conquest.port", null);
	public static final String MAIL_PASSWORD = getSystemProperty("conquest.mail.password", null); 
	public static final boolean MAIL_ACTIVATE = getBooleanSystemProperty("conquest.mail.activate", true);
	
	public static class Constraint {
		
		public static String UK_NAME = "uk_user_name_idx";
		public static String UK_MAIL = "uk_user_email_idx";
		public static String UK_HASH = "uk_user_hash_idx";
		public static String UK_SALT = "uk_user_salt_idx";
	}
	
	private static String getSystemProperty(String property, String defaultValue) {
		String value = System.getProperty(property);
		if (value == null) {
			value = defaultValue;
		}
		return value;
	}

	private static boolean getBooleanSystemProperty(String property, boolean defaultValue) {
		String stringValue = System.getProperty(property);
		if (stringValue == null) {
			return defaultValue;
		} else {
			return new Boolean(stringValue);
		}
	}
}
